<?php
/**
 * Name: SystemController.class.php
 * Description:系统设置
 * User: DIY
 * Date: 2016/9/6
 * Time: 15:58
 */

namespace Admin\Controller;


use Common\Model\SystemModel;

class SystemController extends BaseController{

    /*
     * 网站系统设置
     * */
    public function index(){
        $SystemModel = new SystemModel();

        $system = $SystemModel->getSystemArrayList();
        $this->assign('system',$system);
        $this->display();

    }
    public function edit(){
        $SystemModel = new SystemModel();
        if(IS_POST){
            $list = I('post.system');
            foreach($list as $key=>$value){
                $SystemModel->where(array('type'=>$key))->save(array('value'=>$value));
            }
            //$this->ajaxReturn(array('status'=>100,'msg'=>'保存成功','url'=>U('Admin/System/index')));
            $this->success('保存成功',U('Admin/System/index'));
        }
        else{
            $this->error('错误请求');
        }
    }
}